integrated some changes, still need to fix something