Improve code structure by creating Map class