a modified version of http://labix.org/gommap