Kodex re-factor + tests