Fixed duration from metadata, code cleanup