Restructured into multiple files, added comments