Some refactering