Added XLS support. Many minor changes