Modified code to work without external flash. Only for testing