Cleanup and improve FRAP script