closes #544 closes #513

This is a little jacked up because I'm switching between the ckan2-2 branch and marianne-dev :/