added methods to homecontroller, made it reuseable in other controller