Code clean up + comments for server