code is getting messy, need to re-factor