refactors to make it lighter and tighter