Main Framework classes copied together from various projects. NOT WORKING AT THE MOMENT!