Implemented adding compounds, some code improvements.