works, need to clean up the hacky code