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