Implemented better alternative to std::vector.
Fixes to formatting and cleanup.