Source format and bug fixing