fixed bugs and added settings pages