almost all utilitaries done, need to work on main loop