first pass at writing functions