+ Cleaned formatting
+ Changed vector access function from direct to vector::at functon for safer access and implemented error handling