Added close functionality - partially working