Infered typing and cleanup