refactored home.c