Needs proper tests