Improved code for home