done, just need to modularize code