now works! currently uses imperative paradigm