Various changes, refactoring into BLL and DLL