code cleanup (using new and already existing structures)