added the basic code and optimized file