Attempt at merging scope and joint functions.

List all the things I'm doing wrong, @kapv89 :P