Refactor some codes in spine.coffee, relation.coffee

You can see each step in the commit logs.
Please let me know if I missed  something or cause error.
Thanks everyone!!