Code refactor, see README