copied from homecontroller