Fixed up mongoose join and cleaned up code