use home variable instead of /home/user/ and minor changes