still need to clean up the code