I've added boundary condition, some style changes to the code.