wrapped up implementation, comments, cleanup