quick refactor and bug fix from setting defaults to 0