Reorganize some code on Map.java and MapImage.java