fixed some issues. compilable but still not finished.