Refacored into separate files