revised merging pt 1 (rest in comments, forgot to commit