Add lpwd command and cleaned code