implemented parsing function