working but has bugs