First working function after converting into module