final version 1, still have problems