implement parse function