working but needs comments