basic implemented, but has bugs