Added close connections and some minor features