merging final changes. only 1 bug left, will fix it soon.