resolving merge conflict, fixing other small bugs