Removed useless not_connected method
Added close connection method & tidied code