clean up and full impl