mostly cloned ruby version... not sure if cheating