improved .map file parser (thanks Jaewon Jung)