Fixed last checking... code still needs cleanup