(refactor) Refectored to use functional declaration