Brought code out of app