Added handling of null/empty parameters
Removed unnecessary exposed ports
Replaced pushd and popd since they don't work