Completed working code!