Adding markers by locationand some code refactoring