refactorted some stuff