refactored code into a new Marker class and added specs for MArker class