Divided into different files and added documentation.