re-coded mastermind, made neater and fully functional