Added library project and fixed crashes