Basic implementation for hw4