Improved target and added custom end handler