Adding map and cleaning code