finished implementation, changed variable names and used structures