fixed poorly written code to function again