Make ruby code (mostly) rubocop compliant
Improve readability and standardise javascript code