edited my crappy code