Made code less hard-coded