Still debugging and testing

This is just a test code. Once done, will add it to the main file.