finished with minor bugs