Code clean-up. Created API class.