added close implementation and improved names