almost finished, some fixes needed