My implementation for the CS193p project