refactored further into fn
made return work
merged in fn