adding code from fourgablesguy instructions