Moved util functions into separate file
Additional work done on subtitle code