restructured file - cleaner code