Improve source handling