Basic implementation of pseudocode from Friday