Added port parameter; Added shutdown function