Implemented a smaller vector and cleaned up code.