Tried some functional peogramming