Changed main methods, ready for testing