Splitting logic by filetype

Woo!