Use camelCase for javascript and slice(-1) instead of regex for readability