Add extra options for fpm and improve code