reorganizing code to standard structure