basically works, need to clean up