remove unused files and do some optimizations