Separated logic in its own file