Some refactory work