File organisation and code fix

File organisation and code fix