Tried doing a huge brick but it was just worse than a vanilla approach. So with 75 minutes left until the deadline I threw out everything and made this.